﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Infrastructure.DataTypes
{
    public class Continuous : ICountable
    {
        private double m_dValue;
        private double m_minValue = 1;
        private double m_maxValue = 5;

        public static implicit operator double(Continuous d)
        {
            return d.m_dValue;
        }
        public static implicit operator Continuous(double dValue)
        {
            return new Continuous(dValue);
        }

        public Continuous()
        {
            m_dValue = 0;
        }
        public Continuous(double dValue)
        {
            m_dValue = dValue;
        }
        /// <summary>
        /// print value to string
        /// </summary>
        /// <returns></returns>
        public override String ToString()
        {
            return m_dValue.ToString();
        }

        public double getMinValue()
        {
            return m_minValue;
        }
        public double getMaxValue()
        {
            return m_maxValue;
        }


        #region ICountable Members

        protected override double ToDouble()
        {
            return System.Convert.ToDouble(m_dValue);
        }

        public override double MaxValue
        {
            get { return m_maxValue; }
        }

        public override double MinValue
        {
            get { return m_minValue; }
        }
        public override double Value
        {
            get
            {
                return m_dValue;
            }
            set
            {
                m_dValue = value;
            }
        }

        #endregion
    }
}
